﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Customer_Profile.eCard.DBDao;
using KVB.Common;

namespace Customer_Profile.eCard
{
    public partial class Transfer : System.Web.UI.Page
    {
        string strCardNo = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["CARDNO"] != null)
            {
                strCardNo = Request["CARDNO"].ToString();
            }
            
            if (!Page.IsPostBack)
            {
                Comm.BindDll(ref dropToAccount, "ToAccount", false, "");
                Comm.BindDll(ref dropPayMethod, "PayMethod", false, "");
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string deal_no = "234";
                string card_no = strCardNo;
                string account_name = txtAccountName.Value;
                string bank_name = txtBankName.Value;
                string account_no = txtAccountNO.Value;
                string transfer_type = dropPayMethod.SelectedItem.Value;
                decimal transfer_amount = decimal.Parse(txtTransferAmount.Value.ToString());
                string to_account = dropToAccount.SelectedItem.Value;
                string remit_date = txtTransferDate.Value.Trim();       //到账时间
                string remark = txtRemark.Value;

                bool bok = true; //TransferDao.AddTransfer(deal_no,card_no, account_name, bank_name, account_no, transfer_type, transfer_amount, to_account, remit_date, remark);
               if (bok)
                   Response.Write("<script language=javascript>alert('success');</script>");
               else
                   Response.Write("<script language=javascript>alert('error');</script>");
            }
            catch (Exception ex)
            {
                Log.WriteDefaultLog("Transfer.btnSave_Click", ex.ToString());
                Response.Write("<script language=javascript>alert('Error!');</script>");
            }
        }

        protected void btnBack_Click(object sender, EventArgs e)
        {
            //transferSearchList.aspx
            Response.Redirect("transferSearchList.aspx?CARDNO=" + strCardNo);
        }
    }
}